<?php

// Step 1: APPLICATION_PATH
define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
set_include_path(
    APPLICATION_PATH . '/../library'
    . PATH_SEPARATOR . APPLICATION_PATH . '/models' . PATH_SEPARATOR . get_include_path() 
    
);

// Step 2: AUTOLOADER
require_once "Zend/Loader/Autoloader.php";
$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('Zend_');
$autoLoader->registerNamespace('Ht_');
$autoLoader->registerNamespace('Model_');

#define('APPLICATION_ENVIRONMENT', 'production');

// Step 3: REQUIRE APPLICATION BOOTSTRAP

try {
    require '../application/bootstrap.php';
} catch (Exception $exception) {
    echo '<html><body><center>'
       . 'An exception occured while bootstrapping the application.';
    if (defined('APPLICATION_ENVIRONMENT')
        && APPLICATION_ENVIRONMENT != 'production'
    ) {
        echo '<br /><br />' . $exception->getMessage() . '<br />'
           . '<div align="left">Stack Trace:'
           . '<pre>' . $exception->getTraceAsString() . '</pre></div>';
    }
    echo '</center></body></html>';
    exit(1);
}

$invoice = new Model_Invoice();
$invoice->writeDueInvoices();

?>